const log4js = require("log4js");
log4js.configure({
  appenders: {
    out: {
      type: "console",
    },
    fileAppender: {
      type: "dateFile",
      filename: "logs/app.log",
      encoding: "utf-8",
      pattern: "yyyy-MM-dd.log",
      alwaysIncludePattern: true,
    },
  },
  categories: {
    default: { appenders: ["out", "fileAppender"], level: "debug" },
  },
});

const logger = log4js.getLogger();
logger.level = "debug";

module.exports = logger;
